//
//  ArchiverData.m
//  记账本
//
//  Created by lirilu on 15/4/12.
//  Copyright (c) 2015年 glirlu@gmail.com. All rights reserved.
//

#import "ArchiverData.h"

@implementation ArchiverData
+(NSString*)filePath{
    NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
    NSString *path = [docPath stringByAppendingPathComponent:@"ArchiverData.data"];
    return path;
}

//归档解档的时候会用到
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.achiverFileName forKey:@"achiverFileName"];
    [aCoder encodeObject:self.achiverDate forKey:@"achiverDate"];
    [aCoder encodeObject:[NSString stringWithFormat:@"%.2f",self.outMoney] forKey:@"outMoney"];
    [aCoder encodeObject:[NSString stringWithFormat:@"%.2f",self.inMoney] forKey:@"inMoney"];
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    self.achiverFileName = [aDecoder decodeObjectForKey:@"achiverFileName"];
    self.achiverDate = [aDecoder decodeObjectForKey:@"achiverDate"];
    self.inMoney = [[aDecoder decodeObjectForKey:@"inMoeny"] floatValue];
    self.outMoney = [[aDecoder decodeObjectForKey:@"outMoney"] floatValue];
    return  self;
}
@end
